// 文章详情
.post-row {
  display: flex;
  box-sizing: border-box;
  if (hexo-config('sidebar.position') == 'left') {
    flex-direction: row-reverse;
  }
  @media screen and (max-width: 992px) {
    & {
      flex-direction: column;
    }
  }
}
.post-detail-content {
  padding-bottom: 10px;
  width: 75%;
  justify-content: space-between;
  margin: 0 auto;
  @media screen and (max-width: 992px) {
    width: 100%;  
  }
}
.justify-position {
  justify-content: space-between;
}

.main-content {
  width: calc(100% - 255px);
  margin-top: 15px;
  transition: width 0.3s;
}

#waifu #live2d {
  margin-left: -50px;
}

.post-detail {
  padding: 20px 40px;
  color: #273849;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6rem;
  letter-spacing: 0;
  margin: 0;
  overflow-x: hidden;
  background-color: alpha(#fff, $color-post-contentOpacity);
  border-radius: 8px;
  box-shadow: 0 0 5px #ccc;
  font-family: $color-post-fontFamily;
  position: relative;

  .post-title {
    text-align: center;
    font-size: 1.6em;
    color: #273849;
    font-weight: 700;
    margin: 10px 0 30px 0;
  }

  .post-tags-categories {
    display: flex;
    justify-content: flex-end;
    margin: 10px 0;

    .tags, .category {
      margin-right: 10px;
    }

    .tags {
      a {
        display: inline-block;
        border: 1px solid $color-primary;
        color: $color-primary !important;
        padding: 2px 20px;
        border-radius: 20px;
        margin-top: 10px;

        &:hover {
          color: $color-inner !important;
          background-color: $color-primary;
        }
      }
    }
  }

  .post-content {
    margin-top: 20px;

    .headerlink {
      position: relative;
    }

    // h1:hover .headerlink::before, h2:hover .headerlink::before, h3:hover .headerlink::before, h4:hover .headerlink::before, h5:hover .headerlink::before, h6:hover .headerlink::before {
    //   opacity: 1;
    // }

    // .headerlink::before {
    //   content: '#';
    //   position: absolute;
    //   left: -15px;
    //   top: 50%;
    //   transform: translateY(-50%);
    //   opacity: 0;
    //   transition: all 0.3s;
    //   color: $color-primary;
    // }
  }

  img:not(.swiper-slide-img) {
    max-width: 100%;
    margin: 0 auto;
    display: block;
  }

  .gallery, .btns, .site-card {
    img {
      margin: 0;
      transform: translateX(0);
    }
  }

  blockquote {
    border-left: 5px solid #42b983;
    padding: 1rem 0.8rem 0.2rem 0.8rem;
    background-color: rgba(66, 185, 131, 0.1);
    margin: 0;
    word-break: break-all;
  }

  code:not([class *='language'] ) {
    padding: 1px 5px;
    top: 13px !important;
    font-family: Inconsolata, Monaco, Consolas, 'Courier New', Courier, monospace;
    font-size: 0.91rem;
    color: #476582;
    background: #f1f1f1;
    border-radius: 4px;
  }

  /* 代码块复制按钮 */
  .codeBox {
    /* 方便copy代码按钮（btn-copy）的定位 */
    position: relative;

    .btn-copy {
      display: inline-block;
      cursor: pointer;
      border-radius: 8px
      background-color: $color-primary;
      border: 1px solid $color-primary;

      -webkit-user-select: none;
      -moz-user-select: none;
      -ms-user-select: none;
      user-select: none;
      -webkit-appearance: none;
      font-size: 13px;
      font-weight: 700;
      line-height: 20px;

      color: #fff;

      -webkit-transition: opacity 0.3s ease-in-out;
      -o-transition: opacity 0.3s ease-in-out;
      transition: opacity 0.3s ease-in-out;
      padding: 2px 6px;
      position: absolute;
      right: 5px;
      top: 5px;
      opacity: 0;
    }

    .btn-copy span {
      margin-left: 5px;
    }
  }

  .codeBox:hover .btn-copy {
    opacity: 1;
  }

  .codeBox:hover .btn-copy:hover {
    background-color: $color-button + 10 * 2% + 1 * 0.5deg;
  }

  /* 代码块复制按钮 */
  :root {
    --side-bar-bg-color: #fff;
    --control-text-color: #777;
    --font-sans-serif: 'Ubuntu', 'Source Sans Pro', sans-serif !important;
    --font-monospace: 'Fira Code', 'Roboto Mono', monospace !important;
  }

  a:not(.toc-link) {
    color: #42b983;
    font-weight: 600;
    text-decoration: none;
  }

  h1, h2, h3, h4, h5, h6 {
    position: relative;
    box-sizing: border-box;
    margin-top: 1rem;
    margin-bottom: 1rem;
    font-weight: bold;
    line-height: 1.4;
    cursor: $cursor-text, text;
    color: #213547;
  }

  h1:focus, h2:focus, h3:focus, h4:focus, h5:focus, h6:focus {
    outline: none;
  }

  h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor {
    text-decoration: none;
  }

  h1 tt, h1 code {
    font-size: inherit !important;
  }

  h2 tt, h2 code {
    font-size: inherit !important;
  }

  h3 tt, h3 code {
    font-size: inherit !important;
  }

  h4 tt, h4 code {
    font-size: inherit !important;
  }

  h5 tt, h5 code {
    font-size: inherit !important;
  }

  h6 tt, h6 code {
    font-size: inherit !important;
  }

  h2 a, h3 a {
    color: #273849;
  }

  h1 {
    padding-bottom: 0.4rem;
    font-size: 2.2rem;
    line-height: 1.3;
  }
  h1:not(.bamboo-h):not(.bamboo-h-b) {
    color: #fff;
    background-color: $color-primary;
    width: fit-content;
    border-bottom-right-radius: 100px;
    margin-top: 47px;
    margin-bottom: 16px;
    padding: 4px 48px 4px 8px;
    transition: all .3s ease-out;
  }
  h2 {
    font-size: 1.75rem;
    line-height: 1.225;
    margin: 35px 0 15px;
    padding-bottom: 0.5em;
  }

  h2:not(.bamboo-h):not(.bamboo-h-b):before {
    content: '';
    width: 100%;
    padding: 0px 24px;
    border-bottom: 1px solid #eee;
    position: absolute;
    bottom: -1px;
    left: -24px;
    box-sizing: unset;
  }
  h2:not(.bamboo-h):not(.bamboo-h-b):after {
    transition: all 0.35s ease-out;
    content: '';
    position: absolute;
    background: $color-primary;
    width: 1em;
    height: 5px;
    bottom: -3px;
    left: 0;
    border-radius: 10px;
  }
  h2:not(.bamboo-h):not(.bamboo-h-b):hover {
    &:after {
      width: 2em; 
    }
  }
  h3 {
    font-size: 1.4rem;
    line-height: 1.43;
    margin: 20px 0 7px;
    padding-bottom: 0.5em;
    border-bottom: 1px solid #ddd;
  }

  h4 {
    font-size: 1.2rem;
    padding-left: 10px;
  }

  h4:not(.bamboo-h):not(.bamboo-h-b) {
    border-left: 5px solid $color-primary;
  }

  h5 {
    font-size: 1rem;
  }

  h6 {
    font-size: 1rem;
    color: #777;
  }

  p {
    color: #213547;
  }

  p, blockquote, ul, ol, dl, table {
    margin: 0.8em 0;
  }

  li > ol, li > ul {
    margin: 0 0;
  }

  hr {
    height: 2px;
    padding: 0;
    margin: 16px 0;
    background-color: #e7e7e7;
    border: 0 none;
    overflow: hidden;
    box-sizing: content-box;
  }
  a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
    margin-top: 0;
    padding-top: 0;
  }

  h1 p, h2 p, h3 p, h4 p, h5 p, h6 p {
    margin-top: 0;
  }

  li p.first {
    display: inline-block;
  }

  ul, ol {
    // padding-left: 30px;
  }

  ul:last-child, ol:last-child {
    margin-bottom: 0;
  }

  ul {
    list-style: none;
  }
  ul:not(.post-copyright):not(.nav-tabs) li {
    position: relative;
    padding: 8px 0;
    padding-left: 25px;
    &::before {
      content: '';
      width: 14px;
      height: 14px;
      background: $color-primary;
      display: inline-block;
      vertical-align: middle;
      margin-top: -2px;
      margin-right: 11px;
      margin-left: -25px;
      border-radius: 100%;
      border: 3px solid #fff;
      position: relative;
      box-sizing: border-box;
    }
    &:not(:last-child)::after {
      content: '';
      height: 100%;
      width: 2px;
      background: $color-primary;
      position: absolute;
      left: 6px;
      top: 20px;
      box-sizing: border-box;
    }
  }
  
  ol {
    list-style-type: none;
    counter-reset: item;
    box-sizing: border-box;
    padding: 0 0 0 2.5em;
  }
  ol > li {
    position: relative;
    padding: 0.4rem 0;
    &::before {
      content: counter(item);
      counter-increment: item;
      position: absolute;
      top: 0.4rem;
      left: -2.5em;
      height: 1.6rem;
      width: 1.6rem;
      text-align: center;
      border-radius: 8px;
      line-height: 1.6rem;
      background-color: $color-primary + 8 * 10% + 1 * .5deg;
      color: $color-primary;
    }
  }
  blockquote {
    padding: 12px 24px 12px 30px;
    border-left-width: 4px;
    border-left-style: solid;
    border-radius: 4px;
    margin: 1rem 0;
    background-color: rgba(66, 185, 131, 0.1);
    border-color: $color-primary;
    position: relative;

    &::before {
      content: '\f129';
      background-color: $color-primary;
      position: absolute;
      top: 14px;
      left: -12px;
      color: #fff;
      width: 20px;
      height: 20px;
      border-radius: 100%;
      text-align: center;
      line-height: 20px;
      font-weight: bold;
      font-family: 'Font Awesome 6 Free';
      font-weight: 600;
      font-size: 14px;
    }
  }

  table {
    padding: 0;
    word-break: initial;
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    border-spacing: 0;
    overflow: auto;
    border: 1px solid $color-primary + 8 * 10% + 1 * .5deg;
  }

  table tr {
    margin: 0;
    padding: 0;
  }

  table tr:nth-child(2n), thead {
    background-color: alpha($color-primary + 9.3 * 10% + 1 * .5deg, $color-post-contentOpacity);
  }

  table tr th {
    font-weight: bold;
    border: 1px solid $color-primary + 8 * 10% + 1 * .5deg;
    border-bottom: 0;
    text-align: left;
    margin: 0;
    padding: 6px 13px;
    background-color: $color-primary + 8 * 10% + 1 * .5deg;
    color: $color-primary;
  }

  table tr td {
    text-align: left;
    margin: 0;
    padding: 6px 13px;
    word-wrap: break-word;
    border: 1px solid $color-primary + 8 * 10% + 1 * .5deg;
  }
  table:not(.highlight table) tr:hover {
    background-color: $color-primary + 8.5 * 10% + 1 * .5deg;
  }
  table tr th:first-child, table tr td:first-child {
    margin-top: 0;
  }

  table tr th:last-child, table tr td:last-child {
    margin-bottom: 0;
  }

  p {
    margin: 2px 2px 10px;
    font-size: 16px;
    line-height: 1.7;
  }
  a:not(.post-copyright) {
    // a链接的动画特效，取消注释的话，会对其他标签有影响
    // display: inline-block;
    // cursor: pointer;
    // text-decoration: none;
    // position: relative;
    // &:after {
    //   content: "";
    //   position: absolute;
    //   width: 98%;
    //   height: 1px;
    //   bottom: 0;
    //   left: 0;
    //   transform: scaleX(0);
    //   background-color: $color-primary ;
    //   transform-origin: bottom right;
    //   transition: transform .3s ease-in-out;
    // }
    // &:hover:after {
    //   transform: scaleX(1);
    //   transform-origin: bottom left;  
    // }
  }
  
}

@media (max-width: 992px) {
  .justify-center {
    justify-content: center;
  }

  .main-content {
    width: 100% !important;
    margin: 0 auto !important;
    margin-top: 10px !important;
  }
}

@media (max-width: 551px) {
  .post-detail {
    padding: 15px 15px 20px 18px;
  }
}
